<?php

namespace app\common\shop;

use think\Db;
use think\Model;
use traits\model\SoftDelete;

// 代理商
class UserAreaLevelModel extends model {
    // 完整数据表名
    protected $table = 'user_area_level';
    /**
     * [建表]
     * @return
     */
    public static function createTable(){
        return Db::query("CREATE TABLE If Not Exists `user_area_level` (
              `id` int(11) NOT NULL AUTO_INCREMENT,
              `name` varchar(255) NOT NULL  DEFAULT '0' COMMENT '名称',
              `alliance` decimal(22,2) NOT NULL DEFAULT '0' COMMENT '加盟条件',
              `selfpercentage` decimal(22,2) NOT NULL DEFAULT '0' COMMENT '直推佣金提成',
              `percentage` decimal(22,2) NOT NULL DEFAULT '0' COMMENT '佣金提成',
              `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
              PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='区域代理商设置表'");
    }
    /**
     * [添加]
     * @return
     */
    public function add($data){
        $data['createtime'] = time();
        return self::insertGetId($data);
    }
}